<?php
/**
 * Created by PhpStorm.
 * User: Dominik
 * Date: 3/26/14
 * Time: 1:06 PM
 */
class Validator{

    function validAlfanumeric($alfaNumeric){
        if(!preg_match('/^[a-zA-Z0-9]+$/',$alfaNumeric)){
            return true;
        }else{
            return false;
        }
    }

    function validAlfaAndSpace($alfaNumeric){
        if(!preg_match('/^[ a-zA-Z]+$/',$alfaNumeric)){
            return true;
        }else{
            return false;
        }
    }

    function validSpace($space){
        if(!preg_match('/\s/',$space)){
            return true;
        }else{
            return false;
        }
    }

    function validEmail($email){
        if(preg_match("/^\S+@\S+\.\S+$/", $email)){
            return true;
        }else{
            return false;
        }
    }

    function validPassword($password){
        if(preg_match("/[A-Za-z0-9!#$]/", $password)){
           return true;
        }else{
            return false;
        }
    }
}

?>